<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <!-- 
        sessionStorage的API和localStorage的一样，但是存储的数据在浏览器关闭后就会清空
     -->
    <button onclick="saveData()">点我保存数据</button>
    <script>
        function saveData() {
            sessionStorage.setItem('m1', 'hello JS')
        }
    </script>
</body>

</html>